Alkis Test#
import geopandas as gpd
import pyproj # we need this for jupyter-book to build right
import zipfile
import folium
# Specify the path to the zipped shapefile
# zip_path = r'C:\Users\plank\Documents\git\r4r-prototypes\prototypes\in\alkiswfs-request-obg-1710239261403.zip'
# # Extract the shapefile from the zip file
# with zipfile.ZipFile(zip_path, 'r') as zip_ref:
# zip_ref.extractall('temp_folder')
# Read the shapefile using geopandas
# shapefile_path = r'C:\Users\plank\Documents\git\r4r-prototypes\prototypes\in\shape_files_freiberg\ALKIS-Vereinfacht\Flurstueck.shp'
# shapefile_path = r'C:\Users\plank\Documents\git\r4r-prototypes\prototypes\in\shape_files_freiberg\ALKIS-Vereinfacht\Nutzung.shp'
# shapefile_path = r'C:\Users\plank\Documents\git\r4r-prototypes\prototypes\in\shape_files_freiberg\ALKIS-Vereinfacht\FlurstueckPunkt.shp'
shapefile_path = r'C:\Users\plank\Documents\git\r4r-prototypes\prototypes\in\Alkis-Dresden\NutzungFlurstueck.shp'
# shapefile_path = r'C:\Users\plank\Documents\git\r4r-prototypes\prototypes\in\Alkis-Dresden\Nutzung.shp'
gdf = gpd.read_file(shapefile_path)
# Display the contents of the shapefile
# print(gdf.head(20))
gdf_summary = gdf.describe()
print(gdf_summary)
gml_id \
count 2556
unique 2556
top DESNALK0q8004EUaDESNALK0q8002M95TF
freq 1
oid aktualit nutzart \
count 2556 2556 2556
unique 2556 151 15
top DESNALK0q8004EUaDESNALK0q8002M95TF 2015-03-01Z Straßenverkehr
freq 1 406 885
bez name flstkennz \
count 664 0 2556
unique 5 0 2032
top Handel und Dienstleistung NaN 140208___03200000700
freq 375 NaN 12
geometry
count 2556
unique 2556
top POLYGON ((412022.511 5655074.594, 412004.575 5...
freq 1
# Create a folium map object
m = folium.Map(zoom_start=10)
# Add the shapefile to the map
folium.GeoJson(gdf).add_to(m)
# Display the map
m
Make this Notebook Trusted to load map: File -> Trust Notebook
Nutzart |
Count |
|---|---|
Wohnbaufläche |
806 |
Landwirtschaft |
626 |
Straßenverkehr |
306 |
Industrie- und Gewerbefläche |
244 |
Weg |
235 |
Unland/Vegetationslose Fläche |
188 |
Sport-, Freizeit- und Erholungsfläche |
153 |
Wald |
100 |
Platz |
95 |
Fläche besonderer funktionaler Prägung |
86 |
Fließgewässer |
48 |
Stehendes Gewässer |
16 |
Gehölz |
11 |
Halde |
9 |
Bahnverkehr |
9 |
Fläche gemischter Nutzung |
7 |
Tagebau, Grube, Steinbruch |
3 |
Friedhof |
2 |
Alkis kann nicht genutzt werden um Wege zu finden. Da nur wenige Flurstücke als echte Wege eingetragen sind. Außerdem sind die Flurstücke oft größer als ein Gehweg.
# filtered_gdf = gdf[gdf['nutzart'].isin(['Straßenverkehr', 'Weg'])]
filtered_gdf = gdf[gdf['nutzart'].isin(['Weg'])]
# Create a new folium map object
new_map = folium.Map(zoom_start=15)
# Add the filtered_gdf to the map
folium.GeoJson(filtered_gdf).add_to(new_map)
# Display the new map
new_map
Make this Notebook Trusted to load map: File -> Trust Notebook